package com.evenus.infrastructure.url;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class urlReader {
	public static String get(String path) {
		URL url;

		try {
			url = new URL(path);
			HttpURLConnection con = (HttpURLConnection) url.openConnection();

			con.setFollowRedirects(true);
			con.setInstanceFollowRedirects(false);
			con.connect();

			BufferedReader br = new BufferedReader(new InputStreamReader(
					con.getInputStream(), "UTF-8"));

			String line = "";
			StringBuffer content = new StringBuffer("");
			while ((line = br.readLine()) != null) {
				content.append(line + "\r\n");
			}
			return content.toString();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;

	}
}
